mod warp_server;
mod tcp_server;
mod warp_apis;
mod db;
mod db_init;
mod warp_error;
mod mem_data;

use chat_core::my_log;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // 初始化日志
    my_log::init_log();
    // 启动 warp web 服务
    let warp_server = tokio::spawn(async move {
        warp_server::run().await;
    });
    // 启动 tcp 服务
    let tcp_server = tokio::spawn(async move {
        tcp_server::run().await;
    });
    tokio::try_join!(warp_server, tcp_server)?;
    Ok(())
}
